home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacHack 1997
/
MacHack 1997.toast
/
Hacks
/
Hacks ’96
/
VideoFolder 1.0a
/
Source
/
MoreFiles 1.4.1
/
FSpCompat.h
< prev
next >
Wrap
Text File
|
1995-12-21
|
10KB
|
275 lines
/*
** Apple Macintosh Developer Technical Support
**
** FSSpec compatibility functions.
**
** by Jim Luther, Apple Developer Technical Support Emeritus
**
** File: FSpCompat.h
**
** Copyright © 1992-1995 Apple Computer, Inc.
** All rights reserved.
**
** You may incorporate this sample code into your applications without
** restriction, though the sample code has been provided "AS IS" and the
** responsibility for its operation is 100% yours. However, what you are
** not permitted to do is to redistribute the source as "DSC Sample Code"
** after having made changes. If you're going to re-distribute the source,
** we require that you make it clear in the source that the code was
** descended from Apple Sample Code, but that you've made changes.
*/
#ifndef __FSPCOMPAT__
#define __FSPCOMPAT__
#include <Types.h>
#include <Files.h>
/*****************************************************************************/
pascal OSErr FSMakeFSSpecCompat(short vRefNum,
long dirID,
ConstStr255Param fileName,
FSSpecPtr spec);
/* ¶ Initialize a FSSpec record.
The FSMakeFSSpecCompat function fills in the fields of an FSSpec record.
If the file system can't create the FSSpec, then the compatibility code
creates a FSSpec that is exactly like an FSSpec except that spec.name
for a file may not have the same capitalization as the file's catalog
entry on the disk volume. That is because fileName is parsed to get the
name instead of getting the name back from the file system. This works
fine with System 6 where FSMakeSpec isn't available.
vRefNum input: Volume specification.
dirID input: Directory ID.
fileName input: Pointer to object name, or nil when dirID specifies
a directory that's the object.
spec output: A file system specification to be filled in by
FSMakeFSSpecCompat.
*/
/*****************************************************************************/
pascal OSErr FSpOpenDFCompat(const FSSpec *spec,
char permission,
short *refNum);
/* ¶ Open a file's data fork.
The FSpOpenDFCompat function opens the data fork of the file specified
by spec.
Differences from FSpOpenDF: If FSpOpenDF isn't available,
FSpOpenDFCompat uses PHBOpen because System 6 doesn't support PBHOpenDF.
This means FSpOpenDFCompat could accidentally open a driver if the
spec->name begins with a period.
spec input: An FSSpec record specifying the file whose data
fork is to be opened.
permission input: A constant indicating the desired file access
permissions.
refNum output: A reference number of an access path to the file's
data fork.
__________
See also: FSpOpenAware
*/
/*****************************************************************************/
pascal OSErr FSpOpenRFCompat(const FSSpec *spec,
char permission,
short *refNum);
/* ¶ Open a file's resource fork.
The FSpOpenRFCompat function opens the resource fork of the file
specified by spec.
spec input: An FSSpec record specifying the file whose resource
fork is to be opened.
permission input: A constant indicating the desired file access
permissions.
refNum output: A reference number of an access path to the file's
resource fork.
__________
See also: FSpOpenRFAware
*/
/*****************************************************************************/
pascal OSErr FSpCreateCompat(const FSSpec *spec,
OSType creator,
OSType fileType,
ScriptCode scriptTag);
/* ¶ Create a new file.
The FSpCreateCompat function creates a new file with the specified
type, creator, and script code.
Differences from FSpCreate: FSpCreateCompat correctly sets the
fdScript in the file's FXInfo record to scriptTag if the problem
isn't fixed in the File Manager code.
spec input: An FSSpec record specifying the file to create.
creator input: The creator of the new file.
fileType input The file type of the new file.
scriptCode input: The code of the script system in which the file
name is to be displayed.
*/
/*****************************************************************************/
pascal OSErr FSpDirCreateCompat(const FSSpec *spec,
ScriptCode scriptTag,
long *createdDirID);
/* ¶ Create a new directory.
The FSpDirCreateCompat function creates a new directory and returns the
directory ID of the newDirectory.
spec input: An FSSpec record specifying the directory to
create.
scriptCode input: The code of the script system in which the
directory name is to be displayed.
createdDirID output: The directory ID of the directory that was
created.
*/
/*****************************************************************************/
pascal OSErr FSpDeleteCompat(const FSSpec *spec);
/* ¶ Delete a file or directory.
The FSpDeleteCompat function deletes a file or directory.
spec input: An FSSpec record specifying the file or
directory to delete.
*/
/*****************************************************************************/
pascal OSErr FSpGetFInfoCompat(const FSSpec *spec,
FInfo *fndrInfo);
/* ¶ Get the finder information for a file.
The FSpGetFInfoCompat function gets the finder information for a file.
spec input: An FSSpec record specifying the file.
fndrInfo output: If the object is a file, then its FInfo.
__________
Also see: FSpGetDInfo
*/
/*****************************************************************************/
pascal OSErr FSpSetFInfoCompat(const FSSpec *spec,
const FInfo *fndrInfo);
/* ¶ Set the finder information for a file.
The FSpSetFInfoCompat function sets the finder information for a file.
spec input: An FSSpec record specifying the file.
fndrInfo input: The FInfo.
__________
Also see: FSpSetDInfo
*/
/*****************************************************************************/
pascal OSErr FSpSetFLockCompat(const FSSpec *spec);
/* ¶ Lock a file.
The FSpSetFLockCompat function locks a file.
spec input: An FSSpec record specifying the file.
*/
/*****************************************************************************/
pascal OSErr FSpRstFLockCompat(const FSSpec *spec);
/* ¶ Unlock a file.
The FSpRstFLockCompat function unlocks a file.
spec input: An FSSpec record specifying the file.
*/
/*****************************************************************************/
pascal OSErr FSpRenameCompat(const FSSpec *spec,
ConstStr255Param newName);
/* ¶ Rename a file or directory.
The FSpRenameCompat function renames a file or directory.
spec input: An FSSpec record specifying the file.
newName input: The new name of the file or directory.
*/
/*****************************************************************************/
pascal OSErr FSpCatMoveCompat(const FSSpec *source,
const FSSpec *dest);
/* ¶ Move a file or directory to a different location on on the same volume.
The FSpCatMoveCompat function moves a file or directory to a different
location on on the same volume.
source input: An FSSpec record specifying the file or directory.
dest input: An FSSpec record specifying the name and location
of the directory into which the source file or
directory is to be moved.
*/
/*****************************************************************************/
pascal OSErr FSpExchangeFilesCompat(const FSSpec *source,
const FSSpec *dest);
/* ¶ Exchange the data stored in two files on the same volume.
The FSpExchangeFilesCompat function swaps the data in two files by
changing the information in the volume's catalog and, if the files
are open, in the file control blocks.
Differences from FSpExchangeFiles: Correctly exchanges files on volumes
that don't support PBExchangeFiles. FSpExchangeFiles attempts to support
volumes that don't support PBExchangeFiles, but in System 7, 7.0.1, 7.1,
and 7 Pro, the compatibility code just doesn't work on volumes that
don't support PBExchangeFiles (even though you may get a noErr result).
System Update 3.0 and System 7.5 and later have the problems in
FSpExchangeFiles corrected.
*/
/*****************************************************************************/
pascal short FSpOpenResFileCompat(const FSSpec *spec,
SignedByte permission);
/* ¶ Open a file's resource file.
The FSpOpenResFileCompat function opens the resource file specified
by spec.
spec input: An FSSpec record specifying the file whose
resource file is to be opened.
permission input: A constant indicating the desired file access
permissions.
function result output: A resource file reference number, or if there's
an error -1.
*/
/*****************************************************************************/
pascal void FSpCreateResFileCompat(const FSSpec *spec,
OSType creator,
OSType fileType,
ScriptCode scriptTag);
/* ¶ Create a resource file.
The FSpCreateResFileCompat function creates a new resource file with
the specified type, creator, and script code.
Differences from FSpCreateResFile: FSpCreateResFileCompat correctly
sets the fdScript in the file's FXInfo record to scriptTag if the
problem isn't fixed in the File Manager code.
spec input: An FSSpec record specifying the resource file to create.
creator input: The creator of the new file.
fileType input The file type of the new file.
scriptCode input: The code of the script system in which the file
name is to be displayed.
*/
/*****************************************************************************/
#endif /* __FSPCOMPAT__ */